<?php
/* @var $this GadgetcategoryController */
/* @var $model Gadgetcategory */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'gadgetcategory-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array('enctype' => 'multipart/form-data'),
));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	
	<?php //echo $form->hiddenField($model, 'imageUrl'); ?>
	
	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'urlKey'); ?>
		<?php echo $form->textField($model,'urlKey',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'urlKey'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('size'=>200,'maxlength'=>500)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'parentCategoryId'); ?>
		<?php 
		// echo $form->textField($model,'parentCategoryId'); 
		echo CHtml::dropDownList('parentCategoryId', $model->parentCategoryId,   $model->listDataCat(), array('empty' => '(Select a parent category)'));
		?>
		<?php echo $form->error($model,'parentCategoryId'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'templateFile'); ?>
		<?php echo $form->textField($model,'templateFile',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'templateFile'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'isActive'); ?>
		<?php //echo $form->textField($model,'isActive'); ?>
		<?php echo $form->checkBox($model,'isActive'); ?>
		<?php echo $form->error($model,'isActive'); ?>
	</div>
	
	<?php
	if($model->isNewRecord){
		echo '<div class="row">';
		echo $form->labelEx($model, 'imageUrl');
		echo $form->fileField($model, 'imageUrl');
		echo $form->error($model, 'imageUrl');
		echo '</div>';
	}
	?>
	
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>
</div><!-- form -->

<?php
if($model->isNewRecord){

}else{
?>
<h1>
	Image Category
</h1>
<br>
<div class="row">
	
	<?php
	$this->widget('ext.imageSelect.ImageSelect',  array(
        //'path'=>Yii::app()->request->baseUrl.'/uploads/categories/fill/400-400/'.$model->imageUrl,
		'path'=>Yii::app()->request->baseUrl.'/uploads/categories/'.$model->imageUrl,
        'alt'=>'', 
        'uploadUrl'=>Yii::app()->createUrl('categories/manage/upload',array('id'=>$model->id)),
        'htmlOptions'=>array('style'=>'height: 400px')
    ));
	?>
	</div>
<?php
}
?>